<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <link rel="stylesheet" href="css/main.css"  media="all">
    <link rel="stylesheet" href="css/plugins/font-awesome-4.7.0/css/font-awesome.min.css"  media="all">
    <script type="text/javascript" src="js/jquery-1.12.4.js"></script>
    <script src="layui/layui.js"></script>
</head>
<body>

<!--相关的几个模态框-->
<!--1 S    上传图片的模态框-->
<%--隐藏打开的index--%>
<input type="hidden" id="hidden_picture_index">
<div class="x-body"  id="pictureModal">


    <input type="file" id="findFile">
    <button type="button" id="upload">上传</button>
</div>
<!--1 E    上传图片的模态框-->

</body>

<script type="text/javascript">

    layui.use(['table','form','laypage','upload','jquery'], function() {
        var table = layui.table
            , form = layui.form
            , $ = layui.jquery
            , upload = layui.upload;


        upload.render({
            elem: '#findFile'//绑定的元素
            , url:'/cmfz/banner/insertBanner'//提交的url
            , auto: false //是否自动上传
            , accept: "file"   //指定允许上传的文件类型
            //,multiple: true
            , bindAction: '#upload' //选完文件后不自动上传
            ,
            before: function (obj) {
                this.data = {'bu': $('#bu').val()};//关键代码
            }
            , done: function (res) {
                if (res.data == false) {
                    return layer.msg('上传失败');
                }
                else if (res.data == true) {
                    return layer.msg("上传成功！");
                    layer.load();
                }

            }
        });
    });

</script>
</html>